package xinxin.com.SingletonPattern.Singleton;

/**
 * @author ：史鑫鑫
 * @date ：Created in 2019/4/18 17:24
 */
public class SingletonS {

    private SingletonS() {
        System.out.println("构造函数触发");
    }

    public static void fun() {
        System.out.println("测试");
    }

    public static synchronized SingletonS getInstance() {
        return SingletonHolder.instance;
    }

    private static class SingletonHolder {
        private static final SingletonS instance = new SingletonS();
    }
}


